package com.weixin.paleituo.activity;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.weixin.paleituo.R;
import com.weixin.paleituo.adapter.ReleasemanagerRecyclerViewAdapter;
import com.weixin.paleituo.base.BasePersonActivity;
import com.weixin.paleituo.util.UIUtils;

import butterknife.BindView;

public class CollocationReleaseManagerActivity extends BasePersonActivity {

    @BindView(R.id.recycle_activity_collocation_release_manager)
    RecyclerView mRecycleActivityCollocationReleaseManager;
    private View mCollocationReleaseManagerView;
    private ReleasemanagerRecyclerViewAdapter mAdapter;


    @Override
    protected View getContentView(Context context) {
        mCollocationReleaseManagerView = UIUtils.inflate(context, R.layout.activity_collocation_release_manager);
        return mCollocationReleaseManagerView;
    }

    @Override
    protected void initData() {
        super.initData();
        mTvSmalTitle.setText("新增房源");
        mTvSmalTitle.setVisibility(View.VISIBLE);
        mTvTitle.setText("管理发布");
        mAdapter = new ReleasemanagerRecyclerViewAdapter(this);
        //设置布局管理器
        mRecycleActivityCollocationReleaseManager.setLayoutManager(new LinearLayoutManager(this));
        //设置adapter
        mRecycleActivityCollocationReleaseManager.setAdapter(mAdapter);
        //设置Item增加、移除动画
        mRecycleActivityCollocationReleaseManager.setItemAnimator(new DefaultItemAnimator());
        //添加分割线
        mRecycleActivityCollocationReleaseManager.addItemDecoration(new DividerItemDecoration(
                this, DividerItemDecoration.VERTICAL));
    }


    public static void startActivity(Context context){
        Intent intent=new Intent(context,CollocationReleaseManagerActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        mAdapter.setOnItemClickListener(new ReleasemanagerRecyclerViewAdapter.OnItemClickListener() {
            @Override
            public void onClick(View v, int position) {

                ManagerSalerHouserActivity.startActivity(CollocationReleaseManagerActivity.this);

            }

            @Override
            public void onDelectClick(View v, int position) {
                EditHouseInfoActivity.startActivity(CollocationReleaseManagerActivity.this);


            }
        });
    }
}
